home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS03.ADF
/
AmigaBasicProgs
/
CrazyEights
< prev
next >
Wrap
Text File
|
1986-04-02
|
8KB
|
378 lines
REM Eights a card game
' ------ 14-Jan-85
WINDOW 3,"",(357,11)-(630,79),8
WINDOW 2,"",(357,80)-(630,185),8
WINDOW 1,"Eights",(1,1)-(336,185),15
DEFINT a-z
DIM c(52)
DIM a$(26),s$(32)
WINDOW OUTPUT 1
CLS:PRINT :PRINT " *** EIGHTS ***"
PRINT :PRINT " You must 'follow' suit, or change suit
PRINT " with a same number card. Eights allow you
PRINT " to 'call' your suit. If a '7' is played
PRINT " you 'must' play a 7 or draw 3 cards
PRINT " for each 7 played before you. Playing
PRINT " an Ace causes next hand to be skipped. If
PRINT " you don't have a play, press 'd' for draw.
PRINT :PRINT " Scoring >>> Cards left in your hand
PRINT " count against you as follows ....
PRINT
PRINT " 7 ... 10 points
PRINT " 8 ... 5 points
PRINT " A ... 3 points
PRINT " others 1 point.
PRINT :PRINT " Good Luck !"
PRINT :PRINT " Press any key to continue ":con$=INPUT$(1)
FOR p1=1 TO 8 : v(p1)=0 : NEXT p1
Main:
CLS : PRINT :PRINT :PRINT " How many players (2 to 4) ?";:k$=INPUT$(1)
k=VAL(k$) : IF k<2 OR k>4 THEN GOTO Main
n=k
350 :
RANDOMIZE TIMER
a=0 : f7=0 : hndno=hndno+1
CLS : r=52 : PRINT :PRINT : PRINT TAB(3)"Shuffling"
d$="shcd"
a$=" a 2 3 4 5 6 7 8 910 j q k"
s$="spades hearts clubs diamonds"
d=1
FOR i=1 TO 52 : c(i)=0 : NEXT i
FOR p1=1 TO 8 : p(p1)=6 : NEXT p1
COLOR 2,3 : CLS
FOR l0=1 TO n
FOR l1=1 TO 6
GOSUB deal
c((y-1)*4+x)=l0
NEXT l1 : NEXT l0
GOSUB showhand : GOSUB deal
IF y=1 THEN a=1
IF y=7 THEN f7=1
PRINT "Start ---> ";
spk$="start ." : GOSUB speak
GOSUB 2050
spk$=MID$(a$,y*2-1,2)+" of "+MID$(s$,x*8-7,8):GOSUB speak
610 :
s1=x
s2=y
640 :
GOSUB showhand
d=d+1
q1=0 : q2=0
IF d > n THEN d=d-n
IF s2<> 1 OR a=0 THEN GOTO 730
PRINT "Hand #";d;": skipped "
spk$="hand "+STR$(d)+" skipped.":GOSUB speak
a=0
GOTO 640
730 :
IF d=1 THEN GOTO 1270
x=1
750 :
y=1
760 :
IF c((y-1)*4+x) <> d THEN GOTO 880
IF s2<>7 THEN GOTO 830
IF y=7 THEN GOTO 810
IF f7=0 THEN GOTO 830
GOTO 880
810 :
f7=f7+1
GOTO 960
830 :
IF x=s1 OR y=s2 THEN GOTO 930
IF y<> 8 THEN GOTO 880
q1=x : q2=y
880 :
y=y+1 : IF y<=13 THEN GOTO 760
x=x+1 : IF x<=4 THEN GOTO 750
x=q1 : y=q2
GOTO 970
930 :
IF y=7 THEN f7=1
960 :
q1=0 : q2=0
970 :
PRINT "Hand #";d;": ";
IF x<>0 THEN GOTO 1040
PRINT " Draws ";
GOSUB draw
IF m>9 THEN GOTO 1020
PRINT m;" "
spk$="hand "+STR$(d)+" draws "+STR$(m)+".":GOSUB speak
GOTO 640
1020 :
PRINT m
GOTO 640
1040 :
spk$="hand "+STR$(d) : GOSUB speak
GOSUB 2050
spk$=MID$(a$,y*2-1,2)+" of "+MID$(s$,x*8-7,8):GOSUB speak
1050 :
c((y-1)*4+x)=-1
IF q1<>0 AND d<>1 THEN GOTO 1080
IF y<>8 OR d=1 THEN GOTO 1210
1080 :
FOR i=1 TO 5:s(i)=0:NEXT i
FOR x1=1 TO 4
FOR y1=1 TO 13
IF c((y1-1)*4+x1)=d THEN s(x1)=s(x1)+1
NEXT y1 : NEXT x1
FOR x1=1 TO 4
IF s(x1) <= s(5) THEN GOTO 1190
s(5)=s(x1)
x=x1
1190 :
NEXT x1
PRINT " Call: ";MID$(s$,x*8-7,8)
spk$="call " : GOSUB speak
spk$=" "+MID$(s$,x*8-7,8):GOSUB speak
1210 :
p(d)=p(d)-1
IF p(d)=0 THEN GOTO 2380
IF y<> 1 THEN GOTO 610
a=1
GOTO 610
REM input
1270 :
PRINT "Your play: ";
spk$="your play":GOSUB speak
1280 :
GOSUB getinp
IF k<> ASC("d") THEN GOTO 1360
PRINT TAB(12);" Draws ";
GOSUB draw : PRINT m;: IF m<10 THEN PRINT " ";:PRINT
spk$="you draw "+STR$(m):GOSUB speak
GOTO 640
1360 :
IF k<> ASC("1") THEN GOTO 1400
PRINT TAB(12);"";
GOTO 1280
1400 :
l0=0
1410 :
l0=l0+1
IF k=ASC(MID$(a$,l0*2,1)) THEN GOTO 1670
IF l0<13 THEN GOTO 1410
1435 :
PRINT TAB(12);"? ";
GOTO 1280
1670 :
y=l0
PRINT TAB(12);MID$(a$,y*2-1,2);" ";
GOSUB getinp
l0=0
1690 :
l0=l0+1
IF k= ASC(MID$(d$,l0,1)) THEN GOTO 1730
IF l0<4 THEN GOTO 1690
GOTO 1435
1730 :
x=l0
PRINT MID$(s$,x*8-7,8)
spk$=MID$(a$,y*2-1,2)+" of "+MID$(s$,x*8-7,8) :GOSUB speak
IF c((y-1)*4+x)=1 THEN GOTO 1790
PRINT "> Play your own cards!"
spk$="that card is not in your hand." : GOSUB speak
GOTO 1270
1790 :
IF x=s1 OR y=s2 THEN GOTO 1840
IF y=8 THEN GOTO 1840
PRINT "> Follow suit or rank!"
spk$="follow sute or number" : GOSUB speak
GOTO 1270
1840 :
IF s2=7 THEN GOTO 1980
IF y=7 THEN GOTO 1990
1880 :
IF y<>8 THEN GOTO 1050
c((y-1)*4+x)=-1
PRINT " Call: ";
spk$="call ": GOSUB speak
1910 :
GOSUB getinp
l0=0
1920 :
l0=l0+1
IF k=ASC(MID$(d$,l0,1)) THEN GOTO 1960
IF l0<4 THEN GOTO 1920
GOTO 1910
1960 :
x=l0
PRINT MID$(s$,x*8-7,8)
spk$=" "+ MID$(s$,x*8-7,8) : GOSUB speak
GOTO 1210
1980 :
IF y<>7 THEN 2010
1990 :
f7=f7+1
GOTO 1050
2010 :
IF f7=0 THEN GOTO 1880
PRINT "> Play a '7' or Draw!!"
spk$="PLay aey 7 or draw." : GOSUB speak
GOTO 1270
2050 :
REM print
PRINT MID$(a$,y*2-1,2);" ";MID$(s$,x*8-7,8)
RETURN
draw:
m=f7*3 : IF m<1 THEN m=1
m1=m
FOR t=1 TO m1
GOSUB deal
IF m<> m1 THEN GOTO 2160
c((y-1)*4+x)=d
2160 :
NEXT t
p(d)=p(d)+m
f7=0 : RETURN
deal:
IF r<>0 THEN GOTO 2320
PRINT "";
FOR x1=1 TO 52
IF c(x1)<>-1 THEN GOTO 2280
c(x1)=0
r=r+1
2280 :
NEXT x1
c((s2-1)*4+s1)=-1
r=r-1
IF r>0 THEN GOTO 2320
m=m-1
RETURN
2320 :
x= INT(RND*4+1)
z= INT(RND*4)
y= INT(RND*13+1)
IF c((y-1)*4+x)<>0 THEN GOTO 2320
c((y-1)*4+x)=-1
r=r-1
RETURN
2380 : PRINT " * A Winner * ":spk$="aey winner":GOSUB speak: FOR de=1 TO 5000 : NEXT de
CLS : PRINT : PRINT "**** Hand ";d;" Wins! ****" : GOSUB showhand : FOR i=1 TO 1000 :NEXT i
FOR z= 1 TO n
r=0
IF z=1 THEN GOTO 2450
PRINT : PRINT "Hand #";z;": ";
GOTO 2460
2450 :
PRINT "Your Hand: ";
2460 :
FOR x=1 TO 4
FOR y=1 TO 13
IF c((y-1)*4+x) <> z THEN GOTO 2570
GOSUB 2050 : r=r+1
PRINT " ";
IF y=1 THEN r=r+2
IF y=7 THEN r=r+9
IF y=8 THEN r=r+4
2570 :
NEXT y : NEXT x
PRINT "-----------" : PRINT " ";
IF r<>1 THEN GOTO 2595
PRINT " 1 point "
GOTO 2605
2595 :
IF r<10 THEN PRINT " ";
PRINT r;" Points "
2605 :
v(z)=v(z)+r
NEXT z
IF hndno>9 THEN GOTO 2680
IF hndno=1 THEN GOTO 2681
PRINT :PRINT "After ";hndno;" hands" : GOTO 2689
2680 :
PRINT :PRINT "After ";hndno;" hands" : GOTO 2689
2681 :
PRINT :PRINT "After ";hndno;" hand"
2689 :
PRINT "----------------"
FOR z=1 TO n
IF z>1 THEN GOTO 2740
PRINT "Your hand: ";
GOTO 2745
2740 :
PRINT "Hand #";z;": ";
2745 :
IF v(z)<100 THEN PRINT " ";
IF v(z)<10 THEN PRINT " ";
PRINT v(z)
NEXT z
PRINT " "
PRINT "Another Hand ? ";
GOSUB getinp
IF k<> ASC("n") THEN WINDOW OUTPUT 2 :COLOR 1,0:CLS:WINDOW OUTPUT 1:COLOR 2,3: GOTO 350
COLOR 1,0: WINDOW CLOSE 2:WINDOW CLOSE 3: WINDOW 1,"Basic",,31: END
showhand:
WINDOW OUTPUT 3 : COLOR 1,2
LOCATE 1,1
PRINT "Hand: #Cards" : PRINT "---------------"
FOR x=1 TO n
IF x=1 THEN
PRINT " You : ";
ELSE
PRINT "Hand ";x;" : ";
END IF
IF p(x)<10 THEN PRINT " ";
PRINT p(x): NEXT x :PRINT
WINDOW OUTPUT 1
IF d<>1 THEN GOTO 4080
WINDOW OUTPUT 2
LOCATE 1,1 : PRINT " Your Hand " : PRINT "-----------"
FOR x=1 TO 4 : FOR y=1 TO 13: IF c((y-1)*4+x)=1 THEN GOSUB 2050
NEXT y : NEXT x : PRINT " "
4080 :
WINDOW OUTPUT 1 : RETURN
getinp:
k$=INPUT$(1) : k=ASC(k$)
RETURN
speak:
IF MID$(spk$,7,1)="h" THEN MID$(spk$,7)="harts "
IF MID$(spk$,7,1)="d" THEN MID$(spk$,7)="di-monds"
temp$=spk$
IF MID$(spk$,1,1)=" " AND MID$(spk$,2,1)="a" THEN spk$="ace of "+RIGHT$(temp$,8)
IF MID$(spk$,2,1)="j" THEN spk$="jack of "+ RIGHT$(temp$,8)
IF MID$(spk$,2,1)="k" THEN spk$="king of "+ RIGHT$(temp$,8)
IF MID$(spk$,2,1)="q" THEN spk$="queen of "+ RIGHT$(temp$,8)
IF LEFT$(spk$,1)="1" THEN spk$="ten of "+RIGHT$(temp$,8)
SAY TRANSLATE$(spk$)
RETURN